#ifndef TILESYSTEM_H
#define TILESYSTEM_H

#include <string>
#include <vector>

namespace griselda
{
    namespace map
    {
        typedef unsigned int tile_id;

        struct map_tile
        {
            bool blocks;
        };

        class tile_container
        {
        private:
            std::vector<map_tile> m_tile_vec;
        public:
            /** create a new tile in the tilecontainer */
            const tile_id create_tile();
            /** get a tile with a tile id */
            const map_tile& tile(tile_id id) const;
            /** edit a tile */
            bool set_tile(tile_id id, const map_tile& tile);
            /** remove a tile */
            bool remove_tile(tile_id id);
            /** get tile count */
            inline const int count() const;
        };

        /** fill a tilecontainer with tiles from a file */
        bool load_tiles(tile_container& tc, const std::string& fn);
        /** save tiles of a tilecontainer in a file */
        bool save_tiles(const tile_container& tc, const std::string& fn);

        /** INLINE IMPLEMENTATION */

        /**
         * Returns the count of tiles in the container.
         *
         * @return tile count
         * @author A. Manz
         */
        const int tile_container::count() const
        {
            return m_tile_vec.size();
        }
    }
}

#endif
